//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package test.test;

import java.util.Random;
import java.util.Scanner;

public class 双色球系统 {
    public 双色球系统() {
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] userNumbers = new int[7];
        int i = 0;

        while(i < userNumbers.length) {
            if (i <= 5) {
                System.out.print("输入第" + (i + 1) + "个红色球的号码(1~33)：");
                userNumbers[i] = sc.nextInt();
                if (userNumbers[i] >= 1 && userNumbers[i] <= 33) {
                    ++i;
                } else {
                    System.out.println("您输入的号码不在范围内，请重新输入");
                }
            } else {
                System.out.print("输入蓝色球的号码（1~16）：");
                userNumbers[i] = sc.nextInt();
                if (userNumbers[i] >= 1 && userNumbers[i] <= 16) {
                    ++i;
                } else {
                    System.out.println("您输入的号码不在范围内,请重新输入");
                }
            }
        }

        openNumber(userNumbers);
    }

    private static void openNumber(int[] userNumbers) {
        int[] winNumbers = winNumber();
        int redWin = 0;
        int blueWin = 0;
        if (winNumbers[6] == userNumbers[6]) {
            ++blueWin;
        }

        for(int i = 0; i <= 5; ++i) {
            if (winNumbers[i] == userNumbers[i]) {
                ++redWin;
            }
        }

        System.out.println("红球中的有：" + redWin + ";蓝球有" + blueWin);
        switch (redWin) {
            case 0:
            case 1:
            case 2:
                switch (blueWin) {
                    case 0:
                        System.out.println("不好意思您没有中奖");
                        return;
                    case 1:
                        System.out.println("恭喜您中了六等奖：5元");
                        return;
                    default:
                        return;
                }
            case 3:
                switch (blueWin) {
                    case 0:
                        System.out.println("不好意思您没有中奖");
                        return;
                    case 1:
                        System.out.println("恭喜您中了五等奖：10元");
                        return;
                    default:
                        return;
                }
            case 4:
                switch (blueWin) {
                    case 0:
                        System.out.println("恭喜您中了五等奖：10元");
                        return;
                    case 1:
                        System.out.println("恭喜您中了四等奖：200元");
                        return;
                    default:
                        return;
                }
            case 5:
                switch (blueWin) {
                    case 0:
                        System.out.println("恭喜您中了四等奖：200元");
                        return;
                    case 1:
                        System.out.println("恭喜您中了三等奖：3000元");
                        return;
                    default:
                        return;
                }
            case 6:
                switch (blueWin) {
                    case 0 -> System.out.println("恭喜您中了二等奖：最高500万");
                    case 1 -> System.out.println("恭喜您中了一等奖：最高1000万");
                }
        }

    }

    public static int[] winNumber() {
        Random random = new Random();
        int[] ints = new int[7];

        for(int i = 0; i < ints.length; ++i) {
            if (i == 6) {
                int number = random.nextInt(16) + 1;
                ints[i] = number;
            } else {
                int number = random.nextInt(33) + 1;
                ints[i] = number;
            }
        }

        return ints;
    }
}
